package com.sky.context;

import io.jsonwebtoken.Claims;

/**
 * ThreadLocal 存入信息到当前线程的局部变量 【每次独立的请求可以共享同一个存储空间】
 */
public class JwtContext {
  private static final ThreadLocal<Claims> CURRENT_LOCAL = new ThreadLocal<>();
  
  public static void setClaims(Claims claims) {
    CURRENT_LOCAL.set(claims);
  }
  
  public static Claims getClaims() {
    return CURRENT_LOCAL.get();
  }
  
  public static void clear() {
    CURRENT_LOCAL.remove();
  }
}
